//
//  BMSLaunchConfigModel.m
//  WDBMS
//
//  Created by YeJary on 2025/5/12.
//

#import "BMSLaunchConfigModel.h"

@implementation BMSLaunchContentModel

+ (instancetype)modelWithDictionary:(NSDictionary *)dict {
    BMSLaunchContentModel *model = [[BMSLaunchContentModel alloc] init];
    model.ywIpCitySwitch = [dict[@"ywIpCitySwitch"] integerValue];
    model.ywIpWhiteCitys = dict[@"ywIpWhiteCitys"] ?: @[];
    model.ywIpBlockCitys = dict[@"ywIpBlockCitys"] ?: @[];
    model.sdk_ad_splash_cool = [dict[@"sdk_ad_splash_cool"] boolValue];
    model.sdk_ad_splash_hot = [dict[@"sdk_ad_splash_hot"] boolValue];
    model.sdk_bms_to_ta = [dict[@"sdk_bms_to_ta"] boolValue];
    return model;
}

@end

@implementation BMSLaunchConfigModel

+ (instancetype)modelWithDictionary:(NSDictionary *)dict {
    BMSLaunchConfigModel *model = [[BMSLaunchConfigModel alloc] init];
    NSDictionary *contentDict = dict[@"content"];
    if ([contentDict isKindOfClass:[NSDictionary class]]) {
        model.content = [BMSLaunchContentModel modelWithDictionary:contentDict];
    } else {
        model.content = [[BMSLaunchContentModel alloc] init];
    }

    model.rnAuth = dict[@"rnAuth"] ? [dict[@"rnAuth"] intValue] : 1;
    model.rnAuthApi = dict[@"rnAuthApi"] ? [dict[@"rnAuthApi"] intValue]: 1;
    model.rnNoAuthBtn = dict[@"rnNoAuthBtn"] ? [dict[@"rnNoAuthBtn"] intValue]: 1;
    model.att = dict[@"att"] ? [dict[@"att"] intValue] : 1;
    model.checkPri = dict[@"checkPri"] ? [dict[@"checkPri"] intValue]: 1;
    model.openPri = dict[@"openPri"] ? [dict[@"openPri"]intValue]: 1;
    model.termUrl = dict[@"termUrl"] ?: @"";
    model.privacyUrl = dict[@"privacyUrl"] ?: @"";
    model.bmsUploadIntervalSec = dict[@"bmsUploadIntervalSec"] ? [dict[@"bmsUploadIntervalSec"]intValue]: 1;
    return model;
}

@end

